package com.api.shopapi.mapper;

import com.api.shopapi.entity.ESeeDoctorRecord;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Repository
@Mapper
public interface ESeeDoctorRecordMapper {

    @Insert("insert into e_see_doctor_record (ESeeDoctorRecordCode,UserCode,ElderlyCode,ElderlyName,Hospital,Department,Doctor,SeeDoctorTime," +
            "FurtherTime,ChiefComplaint,PhysicalExamination,RealityExamination,AuxiliaryExamination,UseMedication,DiagnosisResults," +
            "TreatmentPrescription,AboutTaboo,StaffCode,GovernmentCode,CreateTime) values " +
            "(#{seeDoctorRecord.ESeeDoctorRecordCode},#{seeDoctorRecord.UserCode},#{seeDoctorRecord.ElderlyCode},#{seeDoctorRecord.ElderlyName}," +
            "#{seeDoctorRecord.Hospital},#{seeDoctorRecord.Department},#{seeDoctorRecord.Doctor},#{seeDoctorRecord.SeeDoctorTime}," +
            "#{seeDoctorRecord.FurtherTime},#{seeDoctorRecord.ChiefComplaint},#{seeDoctorRecord.PhysicalExamination},#{seeDoctorRecord.RealityExamination}," +
            "#{seeDoctorRecord.AuxiliaryExamination},#{seeDoctorRecord.UseMedication},#{seeDoctorRecord.DiagnosisResults},#{seeDoctorRecord.TreatmentPrescription}," +
            "#{seeDoctorRecord.AboutTaboo},#{seeDoctorRecord.StaffCode},#{seeDoctorRecord.GovernmentCode},#{seeDoctorRecord.CreateTime})")
    int insert(@Param("seeDoctorRecord") ESeeDoctorRecord seeDoctorRecord);

    @Update("update e_see_doctor_record set Hospital=#{seeDoctorRecord.Hospital},Department=#{seeDoctorRecord.Department},Doctor=#{seeDoctorRecord.Doctor}," +
            "SeeDoctorTime=#{seeDoctorRecord.SeeDoctorTime},FurtherTime=#{seeDoctorRecord.FurtherTime},ChiefComplaint=#{seeDoctorRecord.ChiefComplaint}," +
            "PhysicalExamination=#{seeDoctorRecord.PhysicalExamination},RealityExamination=#{seeDoctorRecord.RealityExamination}," +
            "AuxiliaryExamination=#{seeDoctorRecord.AuxiliaryExamination},UseMedication=#{seeDoctorRecord.UseMedication},DiagnosisResults=#{seeDoctorRecord.DiagnosisResults}," +
            "TreatmentPrescription=#{seeDoctorRecord.TreatmentPrescription},AboutTaboo=#{seeDoctorRecord.AboutTaboo} " +
            "where ESeeDoctorRecordCode=#{seeDoctorRecord.ESeeDoctorRecordCode}")
    int update(@Param("seeDoctorRecord") ESeeDoctorRecord seeDoctorRecord);


    @Delete("delete from e_see_doctor_record where ESeeDoctorRecordCode=#{eSeeDoctorRecordCode}")
    int delete(@Param("eSeeDoctorRecordCode") String eSeeDoctorRecordCode);


    @Select("select * from e_see_doctor_record where ElderlyCode=#{elderlyCode} limit 1")
    ESeeDoctorRecord getByElderlyCode(@Param("elderlyCode") String elderlyCode);
}
